home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.004 / xemacs-1 / xemacs-19.13 / lisp / hyperbole / kotl / kmenu.el < prev    next >
Encoding:
Text File  |  1995-08-29  |  10.8 KB  |  257 lines

  1. ;;!emacs
  2. ;;
  3. ;; FILE:         kmenu.el
  4. ;; SUMMARY:      Pulldown and popup menus for kotl-mode, the Hyperbole Outliner.
  5. ;; USAGE:        GNU Emacs Lisp Library
  6. ;; KEYWORDS:     mouse, outlines, wp
  7. ;;
  8. ;; AUTHOR:       Bob Weiner
  9. ;; ORG:          Motorola, Inc., PPG
  10. ;;
  11. ;; ORIG-DATE:    28-Mar-94 at 11:22:09
  12. ;; LAST-MOD:     25-Aug-95 at 13:53:35 by Bob Weiner
  13. ;;
  14. ;; Copyright (C) 1994-1995 Free Software Foundation, Inc.
  15. ;;
  16. ;; This file is part of Hyperbole.
  17. ;;
  18. ;; DESCRIPTION:  
  19. ;; DESCRIP-END.
  20.  
  21. ;;; ************************************************************************
  22. ;;; Public variables
  23. ;;; ************************************************************************
  24.  
  25. ;;; This definition is used by InfoDock only.
  26. (defconst id-menubar-kotl
  27.   '(
  28.     ("Koutline"
  29.      ["All-Cell-Attributes" (kotl-mode:kcell-help nil -1)  t]
  30.      ["Help"                describe-mode                  t]
  31.      ["Manual"              (id-info "(hyperbole.info)Outliner") t]
  32.      "----"
  33.      ["Save"                save-buffer                    t]
  34.      ["Toggle-Read-Only"    toggle-read-only               t]
  35.      ["Write (Save as)"     kfile:write                    t]
  36.      "----"
  37.      ["Quit"                (id-tool-quit '(kill-buffer nil))  t]
  38.      )
  39.     ("Edit"
  40.      ["Add-Child"           kotl-mode:add-child            t]
  41.      ["Add-Cell"            kotl-mode:add-cell             t]
  42.      ["Add-Parent"          kotl-mode:add-parent           t]
  43.      ["Split-Cell"          kotl-mode:split-cell           t]
  44.      "----"
  45.      ["Kill-to-Cell-End"    kotl-mode:kill-contents        t]
  46.      ["Kill-Tree"           kotl-mode:kill-tree            t]
  47.      ["Yank"                kotl-mode:yank                 t]
  48.      "----"
  49.      ["Copy-After-Cell"     kotl-mode:copy-after           t]
  50.      ["Copy-Before-Cell"    kotl-mode:copy-before          t]
  51.      ["Move-After-Cell"     kotl-mode:move-after           t]
  52.      ["Move-Before-Cell"    kotl-mode:move-before          t]
  53.      "----"
  54.      ["Fill"                kotl-mode:fill-cell            t]
  55.      ["Fill-Paragraph"      kotl-mode:fill-paragraph       t]
  56.      ["Set-Fill-Prefix"     kotl-mode:set-fill-prefix      t]
  57.      )
  58.     ("Jump-to"
  59.      ["Cell"                kotl-mode:goto-cell            t]
  60.      "----"
  61.      ["Cell-Beginning"      kotl-mode:beginning-of-cell    t]
  62.      ["Cell-End"            kotl-mode:end-of-cell          t]
  63.      "----"
  64.      ["Child"               kotl-mode:down-level           t]
  65.      ["Parent"              kotl-mode:up-level             t]
  66.      "----"
  67.      ["Next-Cell"           kotl-mode:next-cell            t]
  68.      ["Prev-Cell"           kotl-mode:previous-cell        t]
  69.      "----"
  70.      ["Next-Same-Level"     kotl-mode:forward-cell         t]
  71.      ["Prev-Same-Level"     kotl-mode:backward-cell        t]
  72.      "----"
  73.      ["First-Sibling"       kotl-mode:first-sibling        t]
  74.      ["Last-Sibling"        kotl-mode:last-sibling         t]
  75.      "----"
  76.      ["Beginning-of-Tree"   kotl-mode:beginning-of-tree    t]
  77.      ["End-of-Tree"         kotl-mode:end-of-tree          t]
  78.      "----"
  79.      ["First-Cell"          kotl-mode:beginning-of-buffer  t]
  80.      ["Last-Cell"           kotl-mode:end-of-buffer        t]
  81.      )
  82.     ("Label-Type"
  83.      ["Alphanumeric (Default)"  (kview:set-label-type kview 'alpha)  t]
  84.      ["Legal"                   (kview:set-label-type kview 'legal)  t]
  85.      ["None"                    (kview:set-label-type kview 'no)     t]
  86.      ["Partial-Alpha"           (kview:set-label-type kview 'partial-alpha) t]
  87.      ["Permanent-Idstamp"       (kview:set-label-type kview 'id)     t]
  88.      ["Stars"                   (kview:set-label-type kview 'star) t]
  89.      )
  90.     ("Link"
  91.      ["Add-at-Point"        klink:create                   t]
  92.      )
  93.     ("Tree"
  94.      ["Copy-to-Buffer"      kotl-mode:copy-to-buffer       t]
  95.      ["Demote"              kotl-mode:demote-tree          t]
  96.      ["Hide (Collapse)"     kotl-mode:hide-tree            t]
  97.      ["Hide-Levels"         kotl-mode:hide-sublevels       t]
  98.      ["Hide-Subtree"        kotl-mode:hide-subtree         t]
  99.      ["Kill"                kotl-mode:kill-tree            t]
  100.      ["Mail"                kotl-mode:mail-tree            t]
  101.      ["Overview"            kotl-mode:overview             t]
  102.      ["Promote"             kotl-mode:promote-tree         t]
  103.      ["Show (Expand)"       kotl-mode:show-tree            t]
  104.      ["Show-All"            kotl-mode:show-all             t]
  105.      ["Show-Subtree"        kotl-mode:show-subtree         t]
  106.      ["Show-Top-Level-Only" kotl-mode:top-cells            t]
  107.      "----"
  108.      ["Copy-After-Cell"     kotl-mode:copy-after           t]
  109.      ["Copy-Before-Cell"    kotl-mode:copy-before          t]
  110.      ["Move-After-Cell"     kotl-mode:move-after           t]
  111.      ["Move-Before-Cell"    kotl-mode:move-before          t]
  112.      "----"
  113.      ["All-Cell-Attributes"     (kotl-mode:kcell-help nil -1)  t]
  114.      ["Current-Cell-Attributes" (kotl-mode:kcell-help)      t]
  115.      ["Current-Tree-Attributes" (kotl-mode:kcell-help nil 2) t]
  116.      )
  117.     ))
  118.  
  119. ;;; This definition is used by InfoDock and XEmacs.
  120. (defconst id-popup-kotl-menu
  121.   '("Koutline"
  122.     ["All-Cell-Attributes" (kotl-mode:kcell-help nil -1)  t]
  123.     ["Help"                describe-mode                  t]
  124.     ["Manual"              (id-info "(hyperbole.info)Outliner") t]
  125.     "----"
  126.     ("Edit"
  127.      ["Add-Child"           kotl-mode:add-child            t]
  128.      ["Add-Cell"            kotl-mode:add-cell             t]
  129.      ["Add-Parent"          kotl-mode:add-parent           t]
  130.      ["Split-Cell"          kotl-mode:split-cell           t]
  131.      "----"
  132.      ["Kill-to-Cell-End"    kotl-mode:kill-contents        t]
  133.      ["Kill-Tree"           kotl-mode:kill-tree            t]
  134.      ["Yank"                kotl-mode:yank                 t]
  135.      "----"
  136.      ["Copy-After-Cell"     kotl-mode:copy-after           t]
  137.      ["Copy-Before-Cell"    kotl-mode:copy-before          t]
  138.      ["Move-After-Cell"     kotl-mode:move-after           t]
  139.      ["Move-Before-Cell"    kotl-mode:move-before          t]
  140.      "----"
  141.      ["Fill"                kotl-mode:fill-cell            t]
  142.      ["Fill-Paragraph"      kotl-mode:fill-paragraph       t]
  143.      ["Set-Fill-Prefix"     kotl-mode:set-fill-prefix      t]
  144.      )
  145.     ("Jump-to"
  146.      ["Cell"                kotl-mode:goto-cell            t]
  147.      "----"
  148.      ["Cell-Beginning"      kotl-mode:beginning-of-cell    t]
  149.      ["Cell-End"            kotl-mode:end-of-cell          t]
  150.      "----"
  151.      ["Child"               kotl-mode:down-level           t]
  152.      ["Parent"              kotl-mode:up-level             t]
  153.      "----"
  154.      ["Next-Cell"           kotl-mode:next-cell            t]
  155.      ["Prev-Cell"           kotl-mode:previous-cell        t]
  156.      "----"
  157.      ["Next-Same-Level"     kotl-mode:forward-cell         t]
  158.      ["Prev-Same-Level"     kotl-mode:backward-cell        t]
  159.      "----"
  160.      ["First-Sibling"       kotl-mode:first-sibling        t]
  161.      ["Last-Sibling"        kotl-mode:last-sibling         t]
  162.      "----"
  163.      ["Beginning-of-Tree"   kotl-mode:beginning-of-tree    t]
  164.      ["End-of-Tree"         kotl-mode:end-of-tree          t]
  165.      "----"
  166.      ["First-Cell"          kotl-mode:beginning-of-buffer  t]
  167.      ["Last-Cell"           kotl-mode:end-of-buffer        t]
  168.      )
  169.     ("Label-Type"
  170.      ["Alphanumeric (Default)"  (kview:set-label-type kview 'alpha)  t]
  171.      ["Legal"                   (kview:set-label-type kview 'legal)  t]
  172.      ["None"                    (kview:set-label-type kview 'no)     t]
  173.      ["Partial-Alpha"           (kview:set-label-type kview 'partial-alpha) t]
  174.      ["Permanent-Idstamp"       (kview:set-label-type kview 'id)     t]
  175.      ["Stars"                   (kview:set-label-type kview 'star) t]
  176.      )
  177.     ("Link"
  178.      ["Add-at-Point"        klink:create                   t]
  179.      )
  180.     ("Tree"
  181.      ["Copy-to-Buffer"      kotl-mode:copy-to-buffer       t]
  182.      ["Demote"              kotl-mode:demote-tree          t]
  183.      ["Hide (Collapse)"     kotl-mode:hide-tree            t]
  184.      ["Hide-Levels"         kotl-mode:hide-sublevels       t]
  185.      ["Hide-Subtree"        kotl-mode:hide-subtree         t]
  186.      ["Kill"                kotl-mode:kill-tree            t]
  187.      ["Mail"                kotl-mode:mail-tree            t]
  188.      ["Promote"             kotl-mode:promote-tree         t]
  189.      ["Show (Expand)"       kotl-mode:show-tree            t]
  190.      ["Show-All"            kotl-mode:show-all             t]
  191.      ["Show-Subtree"        kotl-mode:show-subtree         t]
  192.      ["Show-Top-Level-Only" kotl-mode:top-cells            t]
  193.      "----"
  194.      ["Copy-After-Cell"     kotl-mode:copy-after           t]
  195.      ["Copy-Before-Cell"    kotl-mode:copy-before          t]
  196.      ["Move-After-Cell"     kotl-mode:move-after           t]
  197.      ["Move-Before-Cell"    kotl-mode:move-before          t]
  198.      "----"
  199.      ["All-Cell-Attributes"     (kotl-mode:kcell-help nil -1)  t]
  200.      ["Current-Cell-Attributes" (kotl-mode:kcell-help)      t]
  201.      ["Current-Tree-Attributes" (kotl-mode:kcell-help nil 2) t]
  202.      )
  203.     "----"
  204.     ["Save"                save-buffer                    t]
  205.     ["Toggle-Read-Only"    toggle-read-only               t]
  206.     ["Write (Save as)"     kfile:write                    t]
  207.     "----"
  208.     ["Quit"                (id-tool-quit '(kill-buffer nil))  t]
  209.     ))
  210.  
  211. ;;; ************************************************************************
  212. ;;; Public functions
  213. ;;; ************************************************************************
  214.  
  215. ;;; This definition is used only by XEmacs and Emacs19.
  216. (defun kotl-menubar-menu ()
  217.   "Add a Koutline menu to the menubar for each koutline buffer."
  218.   (cond ((fboundp 'popup-mode-menu)
  219.      (setq mode-popup-menu id-popup-kotl-menu))
  220.     (hyperb:lemacs-p
  221.      (define-key kotl-mode-map 'button3 'kotl-popup-menu))
  222.     (t ;; hyperb:emacs19-p
  223.      (define-key kotl-mode-map [down-mouse-3] 'kotl-popup-menu)
  224.      (define-key kotl-mode-map [mouse-3] nil)))
  225.   (if (and (boundp 'current-menubar)
  226.        current-menubar
  227.        (not (car (find-menu-item current-menubar '("Koutline")))))
  228.       (progn
  229.     (set-buffer-menubar (copy-sequence current-menubar))
  230.     (if (fboundp 'add-submenu)
  231.         (add-submenu nil id-popup-kotl-menu)
  232.       (add-menu nil (car id-popup-kotl-menu) (cdr id-popup-kotl-menu))))))
  233.  
  234. ;;; This definition is used only by XEmacs and Emacs19.
  235. (defun kotl-popup-menu (event)
  236.   "Popup the Koutline buffer menu."
  237.   (interactive "@e")
  238.   (mouse-set-point event)
  239.   (if (fboundp 'popup-mode-menu)
  240.       (popup-mode-menu)
  241.     (popup-menu id-popup-kotl-menu)))
  242.  
  243. (cond ((null hyperb:window-system))
  244.       ((fboundp 'id-menubar-set)
  245.        ;; InfoDock under a window system
  246.        (require 'id-menubars)
  247.        (id-menubar-set 'kotl-mode 'id-menubar-kotl))
  248.       (hyperb:lemacs-p
  249.        ;; XEmacs under a window system
  250.        (add-hook 'kotl-mode-hook 'kotl-menubar-menu))
  251.       (hyperb:emacs19-p
  252.        ;; Emacs 19 under a window system
  253.        (require 'lmenu)
  254.        (add-hook 'kotl-mode-hook 'kotl-menubar-menu)))
  255.  
  256. (provide 'kmenu)
  257.